package com.usian.search.controller.v1;

import com.usian.common.dtos.ResponseResult;
import com.usian.model.article.dtos.ArticleDto;
import com.usian.model.search.dtos.UserSearchDto;
import com.usian.search.service.ApArticleSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 文章搜索控制层
 */
@RestController
@RequestMapping("/api/v1/article/search")
public class ArticleSearchController {

    @Autowired
    private ApArticleSearchService apArticleSearchService;

    /**
     * 文章搜索
     */
    @PostMapping("/search")
    public ResponseResult<List<ArticleDto>> articleSearch(@RequestBody UserSearchDto dto){
        List<ArticleDto> articleDtoList = apArticleSearchService.articleSearch(dto);
        return ResponseResult.ok(articleDtoList);
    }

}
